<%@ page import="com.arvinclub.model.entity.Blog" %><%--
  Created by IntelliJ IDEA.
  User: arvin
  Date: 2019/7/12
  Time: 3:47 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="base.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
    <meta name="description" content=""/>
    <meta name="author" content=""/>
    <link href="https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900" rel="stylesheet" type="text/css"/>
    <title>${someone.name}-个人主页</title>
    <!-- Bootstrap core CSS -->
    <link rel="icon" type="images/x-icon" href="${ctx}file/images/favicon.ico">
    <link href="${ctx}vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <!-- Additional CSS Files -->
    <link rel="stylesheet" href="${ctx}assets/css/fontawesome.css" type="text/css"/>
    <link rel="stylesheet" href="${ctx}assets/css/templatemo-style.css" type="text/css"/>
    <link rel="stylesheet" href="${ctx}assets/css/owl.css" type="text/css"/>
    <link rel="stylesheet" href="${ctx}assets/css/lightbox.css" type="text/css"/>
    <style>
        .myclass:hover {
            color: #4f9bff;
        }

        .myclass {
            display: inline-block;
            color: #a43f49;
        }

        .section-heading {
            padding: 80px 0 45px 0
        }

        .myb1 {
            margin: 30px 0 0 15px;
        }

        .myb2 {
            margin: 30px 15px 0 0;
        }

        @media (max-width: 845px) {
            .section-heading {
                padding: 40px 0 45px 0;
            }

            section.contact-me {
                padding-bottom: 60px;
            }

            .myimg {
                margin: 0 auto;
                text-align: center;
            }

            .myb1 {
                margin: 30px 0 0 0;
            }

            .myb2 {
                margin: 30px 0 0 0;
            }
        }

        @media (min-width: 576px) {
            .container {
                max-width: unset;
            }
        }
    </style>

</head>

<body>
<div id="page-wraper" style="min-height: 100vh">
    <!-- Sidebar Menu -->
    <div class="responsive-nav">
        <i class="fa fa-bars" id="menu-toggle"></i>
        <div id="menu" class="menu">
            <i class="fa fa-times" id="menu-close"></i>
            <div class="container">

                <div class="author-content" style="margin: 80px 0 60px 0">
                    <h4 style="font-size: 40px">${sessionScope.user.name}</h4>
                    <c:choose>
                        <c:when test="${user.admin > 0}">
                            <p style="margin-top: 10px;cursor:pointer"
                               onclick="javascript:window.open('${ctx}admin/manager.html')">管理员</p>
                        </c:when>
                        <c:otherwise>
                            <p style="margin-top: 10px">欢迎</p>
                        </c:otherwise>
                    </c:choose></div>
                <nav class="main-nav" role="navigation">
                    <ul class="main-menu">
                        <li><a href="${ctx}user/blogs.html">网站首页</a></li>
                        <li><a href="${ctx}user/attention.html">关注动态</a></li>
                        <li><a href="${ctx}user/page.html"
                               <c:if test="${someone.id == user.id}">style="background: #fff;color: #8c363e"</c:if>>我的主页</a>
                        </li>
                        <li><a href="${ctx}user/chat.html">在线聊天</a></li>
                        <li><a href="${ctx}user/search.html">查找内容</a></li>
                        <li><a href="${ctx}user/update.html"
                               <c:if test="${someone.id == 4}">style="background: #fff;color: #8c363e"</c:if> >更新日志</a>
                        </li>

                        <li><a href="${ctx}user/exit">退出登录</a></li>
                    </ul>
                </nav>
                <div class="social-network">

                </div>
                <div class="copyright-text">
                    <p>Copyright &copy; 2019 Arvin<br>联系方式: <a
                            href="mailto:arvin5445@qq.com" target="_top">arvin5445@qq.com</a><br><a
                            href="http://beian.miit.gov.cn/" target="_blank">浙ICP备19031638号-1</a></p>
                </div>
            </div>
        </div>
    </div>
    <section class="section contact-me" data-section="section4" style="padding: 0">
        <div class="container" style="max-width: unset">
            <div class="section-heading">
                <h1 style="word-break: break-word">${someone.name}</h1>
                <div class="line-dec"></div>
                <a href="${ctx}user/attentionList/${someone.id}" style="margin-right: 30px;color: #fff">关注:${someone.idolCount}</a>
                <a href="${ctx}user/fansList/${someone.id}" style="color: #fff">粉丝:${someone.fansCount}</a>
                <c:choose>
                    <c:when test="${!hoster && isAttention}">
                        <button style="display: flow-root"
                                onclick="post('${ctx}user/delAttention/${someone.id}/${blogPage.pageNum}')">已关注
                        </button>
                    </c:when>
                    <c:when test="${!hoster && !isAttention}">
                        <button style="display: flow-root"
                                onclick="post('${ctx}user/addAttention/${someone.id}/${blogPage.pageNum}')">关注
                        </button>
                    </c:when>
                </c:choose>

            </div>
        </div>
    </section>

    <section class="section about-me" data-section="section1" style="border-bottom: none">
        <div class="container" style="max-width: unset">
            <c:forEach var="blog" items="${blogPage.list}">
                <div class="right-image-post"
                     onclick="javascript:window.location.href='${ctx}user/detail.html/${blog.id}'">
                    <div class="row">
                        <div class="col-md-6" style="flex: unset;
                max-width: unset;">
                            <div class="left-text">
                                <a style="word-break: break-word"
                                   href="${ctx}user/<c:choose><c:when test="${blog.user.id == 4}">update.html</c:when><c:otherwise>page.html/${blog.user.id}</c:otherwise></c:choose>">

                                    <h4 class="myclass">@<c:out value="${blog.user.name}"/></h4></a>
                                <%
                                    String[] strings = ((Blog) pageContext.getAttribute("blog")).getContent().split("\n");
                                    pageContext.setAttribute("strings", strings);
                                %>
                                <div style="word-break: break-word;font-size: 18px;padding: 30px 15px 0 15px">
                                    <c:forEach items="${pageScope.strings}" var="str">
                                        <c:out value="${str}"/><br>
                                    </c:forEach><br>
                                    <c:if test="${! empty blog.filenameList}">
                                        <div class="myimg">
                                            <c:forEach items="${blog.filenameList}" var="filename">
                                                <a href="${ctx}file/images/${filename}" target="_blank">
                                                    <div style="background: url(${ctx}file/images/${filename}) no-repeat center center ;width: 200px;height: 200px;background-size: cover;display:inline-block;margin:15px 30px 15px 0"></div>
                                                </a>
                                            </c:forEach><br></div>
                                    </c:if>
                                    <br>
                                </div>
                                <span style="color: #666">---<c:out value="${blog.time}"/></span>
                                <span style="display: inline-block;color: #666;float: right">
                                        <a href="${ctx}user/detail.html/${blog.id}"
                                           style="color: #666;">
                                            <c:choose>
                                                <c:when test="${blog.commentCount gt 0}">
                                                    共 ${blog.commentCount} 条评论
                                                </c:when>
                                                <c:otherwise>
                                                    暂无评论
                                                </c:otherwise>
                                            </c:choose>
                                        </a>
                                </span>

                            </div>
                        </div>
                    </div>
                </div>
            </c:forEach>
            <div style="margin: 0 auto;text-align: center">
                <c:choose>
                    <c:when test="${blogPage.list == null || fn:length(blogPage.list) == 0}"><span
                            style="margin-top: 35px;display: inline-block;color: #666">没有任何内容</span></c:when>
                    <c:otherwise><a href="${ctx}user/page.html/${someone.id}/${blogPage.prePage}"
                                    <c:if test="${blogPage.isFirstPage}">style="visibility: hidden" </c:if>>
                        <button style="float: left" class="myb1">上一页</button>
                    </a>


                        <span style="margin-top: 35px;display: inline-block;color: #666"><a
                                href="${ctx}user/page.html/${someone.id}/${blogPage.pageNum}"
                                style="color: #666;">第 ${blogPage.pageNum} 页</a> / <a
                                href="${ctx}user/page.html/${someone.id}/${blogPage.pages}"
                                style="color: #666;">共 ${blogPage.pages} 页</a></span>

                        <a href="${ctx}user/page.html/${someone.id}/${blogPage.nextPage}"
                           <c:if test="${blogPage.isLastPage}">style="visibility: hidden" </c:if>>
                            <button style="float: right" class="myb2">下一页</button>
                        </a></c:otherwise>
                </c:choose>

            </div>
        </div>
    </section>


</div>
<script>
    console.log("感谢您帮我测试,如果发现BUG还请留言。")

    function post(URL) {
        var temp = document.createElement("form");
        temp.action = URL;
        temp.method = "post";
        temp.style.display = "none";

        document.body.appendChild(temp);
        temp.submit();
        return temp;
    }
</script>
<!-- Scripts -->
<!-- Bootstrap core JavaScript -->
<script src="${ctx}vendor/jquery/jquery.min.js" type="text/javascript"></script>
<script src="${ctx}vendor/bootstrap/js/bootstrap.bundle.min.js" type="text/javascript"></script>
<script src="${ctx}assets/js/isotope.min.js" type="text/javascript"></script>
<script src="${ctx}assets/js/owl-carousel.js" type="text/javascript"></script>
<script src="${ctx}assets/js/lightbox.js" type="text/javascript"></script>
<script src="${ctx}assets/js/custom.js" type="text/javascript"></script>

</body>
</html>


